package com.example.leetcode.linkedlist;

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 * int val;
 * ListNode next;
 * ListNode() {}
 * ListNode(int val) { this.val = val; }
 * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution82 {
    public ListNode deleteDuplicates(ListNode head) {
        return LinkedListUtils.deleteDuplicatesII(head);
    }
}

public class leetcode82 {
    public static void main(String[] args) {
        Solution82 solution82 = new Solution82();
        int[] nums = {1, 2, 3, 3, 4, 4, 5};
        test82(solution82, nums);
    }

    private static void test82(Solution82 solution82, int[] nums) {
        ListNode node = solution82.deleteDuplicates(LinkedListUtils.generateLinkedListByArray(nums));
        System.out.println(LinkedListUtils.getLinkedListVals(node));
    }
}
